﻿using System.Collections.Generic;

[System.Serializable]
public class MapConfigSheet
{
    /// <summary>
    /// 地图id
    /// </summary>
    public uint MapID;

    /// <summary>
    /// 地图元素
    /// </summary>
    public int[] Map;

    /// <summary>
    /// 最大宽度
    /// </summary>
    public uint MaxWidth;

    /// <summary>
    /// 最大高度
    /// </summary>
    public uint MaxHeight;


    private static Dictionary<uint, MapConfigSheet> dictionary = new Dictionary<uint, MapConfigSheet>();

    /// <summary>
    /// 通过MapID获取MapConfigSheet的实例
    /// </summary>
    /// <param name="MapID">索引</param>
    /// <returns>MapConfigSheet的实例</returns>
    public static MapConfigSheet Get(uint MapID)
    {
        MapConfigSheet sheet;
        if (dictionary.TryGetValue(MapID, out sheet))
        {
            return sheet;
        }

        return null;
    }
    
    /// <summary>
    /// 获取字典
    /// </summary>
    /// <returns>字典</returns>
    public static Dictionary<uint, MapConfigSheet> GetDictionary()
    {
        return dictionary;
    }
}
